home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / DeskBus.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  5.0 KB  |  157 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DeskBus.a
  3. ;
  4. ;    Contains:    Apple Desktop Bus (ADB) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__DESKBUS__') = 'UNDEFINED' THEN
  18. __DESKBUS__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  24.     include 'MixedMode.a'
  25.     ENDIF
  26.  
  27.     IF TARGET_OS_MAC THEN
  28. ; typedef SInt8                         ADBAddress
  29.  
  30. ;    TempADBServiceRoutineUPP is needed because of circular definition of
  31. ;    ADBServiceRoutineProcPtr and ADBServiceRoutineUpp depending on each other.
  32. ;
  33.  
  34. ; typedef ProcPtr                         TempADBServiceRoutineUPP
  35.  
  36. ADBDataBlock            RECORD 0
  37. devType                     ds.b    1                ; offset: $0 (0)        ;  original handler ID 
  38. origADBAddr                 ds.b    1                ; offset: $1 (1)        ;  original ADB Address 
  39. dbServiceRtPtr             ds.l    1                ; offset: $2 (2)        ;  service routine pointer 
  40. dbDataAreaAddr             ds.l    1                ; offset: $6 (6)        ;  this field is passed as the refCon parameter to the service routine 
  41. sizeof                     EQU *                    ; size:   $A (10)
  42.                         ENDR
  43. ; typedef struct ADBDataBlock *            ADBDBlkPtr
  44.  
  45. ADBSetInfoBlock            RECORD 0
  46. siService                 ds.l    1                ; offset: $0 (0)        ;  service routine pointer 
  47. siDataAreaAddr             ds.l    1                ; offset: $4 (4)        ;  this field is passed as the refCon parameter to the service routine 
  48. sizeof                     EQU *                    ; size:   $8 (8)
  49.                         ENDR
  50. ; typedef struct ADBSetInfoBlock *        ADBSInfoPtr
  51.  
  52. ;  ADBOpBlock is only used when calling ADBOp from 68k assembly code 
  53. ADBOpBlock                RECORD 0
  54. dataBuffPtr                 ds.l    1                ; offset: $0 (0)        ;  buffer: pointer to variable length data buffer 
  55. opServiceRtPtr             ds.l    1                ; offset: $4 (4)        ;  completionProc: completion routine pointer 
  56. opDataAreaPtr             ds.l    1                ; offset: $8 (8)        ;  refCon: this field is passed as the refCon parameter to the completion routine 
  57. sizeof                     EQU *                    ; size:   $C (12)
  58.                         ENDR
  59. ; typedef struct ADBOpBlock *            ADBOpBPtr
  60.  
  61. ;
  62. ; pascal void ADBReInit(void )
  63. ;
  64.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  65.         _ADBReInit:    OPWORD    $A07B
  66.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  67.         IMPORT_CFM_FUNCTION ADBReInit
  68.     ENDIF
  69.  
  70. ;    ADBOp has a different interface for 68k assembly than for everything else
  71. ;    for 68k assembly the interface is 
  72. ;    #pragma parameter __D0 ADBOp(__A0,__D0)
  73. ;    OSErr ADBOp( ADBOpBlock * pb, short commandNum );
  74. ;
  75.  
  76. ;    IMPORTANT NOTE:
  77. ;    "Inside Macintosh: Devices" documents the completion routine for ADBOp will be called with
  78. ;    four parameters using 68k register based calling conventions, specifically the completion routine
  79. ;    passed in should be of type ADBServiceRoutineProcPtr. However, when upp types were first added
  80. ;    to this interface file, the type ADBCompletionUPP was mistakenly used for the second parameter
  81. ;    to ADBOp. Since applications have shipped using completion routines of type ADBCompletionUPP,
  82. ;    the mistake cannot be corrected.
  83. ;    The only difference between ADBServiceRoutineUPP and ADBCompletionUPP is the former takes an extra
  84. ;    argument which is a pointer to itself, fortunately not needed for PowerPC code.
  85. ;    For compatibility with existing 68k code, when an ADBOp completion routine is called,
  86. ;    68k register A1 will point to the completion routine, as documented in Inside Mac.
  87. ;
  88.  
  89. ;
  90. ; pascal OSErr ADBOp(Ptr refCon, ADBCompletionUPP compRout, Ptr buffer, short commandNum)
  91. ;
  92.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  93.         _ADBOp:    OPWORD    $A07C
  94.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  95.         IMPORT_CFM_FUNCTION ADBOp
  96.     ENDIF
  97.  
  98. ;
  99. ; pascal short CountADBs(void )
  100. ;
  101.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  102.         ; returns:
  103.         ;    short           <= D0
  104.         _CountADBs:    OPWORD    $A077
  105.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  106.         IMPORT_CFM_FUNCTION CountADBs
  107.     ENDIF
  108.  
  109. ;
  110. ; pascal ADBAddress GetIndADB(ADBDataBlock *info, short devTableIndex)
  111. ;
  112.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  113.         ; parameters:
  114.         ;    info            => A0
  115.         ;    devTableIndex   => D0
  116.         ; returns:
  117.         ;    ADBAddress      <= D0
  118.         _GetIndADB:    OPWORD    $A078
  119.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  120.         IMPORT_CFM_FUNCTION GetIndADB
  121.     ENDIF
  122.  
  123. ;
  124. ; pascal OSErr GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr)
  125. ;
  126.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  127.         ; parameters:
  128.         ;    info            => A0
  129.         ;    adbAddr         => D0
  130.         ; returns:
  131.         ;    OSErr           <= D0
  132.         _GetADBInfo:    OPWORD    $A079
  133.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  134.         IMPORT_CFM_FUNCTION GetADBInfo
  135.     ENDIF
  136.  
  137. ;
  138. ; pascal OSErr SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr)
  139. ;
  140.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  141.         ; parameters:
  142.         ;    info            => A0
  143.         ;    adbAddr         => D0
  144.         ; returns:
  145.         ;    OSErr           <= D0
  146.         _SetADBInfo:    OPWORD    $A07A
  147.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  148.         IMPORT_CFM_FUNCTION SetADBInfo
  149.     ENDIF
  150.  
  151.     ENDIF    ; TARGET_OS_MAC
  152.     ENDIF ; __DESKBUS__ 
  153.  
  154.